#include<iostream>
#include<vector>
using namespace std;

vector<int>R;
vector<int> C;

int main()
{
    int r, c, n;
    cin >> r >> c >> n;
    for (int i = 0; i < n; i++)
    {
        int input = 0, place = 0;
        cin >> input;
        cin >> place;
        if(!input)
        {
            vector<int>::iterator it = R.begin();
            for (; it != R.end();it++)
            {
                if(*it==place)
                {
                    break;
                }
            }
            if(it==R.end())
            {
                R.push_back(place);
            }
        }
        else
        {
            vector<int>::iterator it = C.begin();
            for (; it != C.end();it++)
            {
                if(*it==place)
                {
                    break;
                }
            }
            if(it==C.end())
            {
                C.push_back(place);
            }
        }
    }
    r -= R.size();
    c -= C.size();
    int ret = r * c;
    cout << ret;
    return 0;
}